//
//  MainViewController.m
//  RESideMenuDemo
//
//  Created by zj on 2019/5/17.
//  Copyright © 2019年 LG. All rights reserved.
//

#import "MainViewController.h"
#import "LancooMeViewController.h"
#import "LancooHomeViewController.h"
#import "LancooNavigationController.h"

@interface MainViewController ()<UITabBarControllerDelegate>

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.delegate = self;
    [self setupUI];
}

- (void)setupUI
{
    [self addChildViewController:[[LancooHomeViewController alloc] init] imageNamed:@"toolbar_home"];
    [self addChildViewController:[[LancooMeViewController alloc] init] imageNamed:@"toolbar_me"];
}

- (void)addChildViewController:(UIViewController *)childController imageNamed:(NSString *)imageName
{
    LancooNavigationController *nav = [[LancooNavigationController alloc] initWithRootViewController:childController];
    childController.tabBarItem.image = [UIImage imageNamed:imageName];
    childController.tabBarItem.selectedImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_sel",imageName]];
    childController.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
    [self addChildViewController:nav];
}

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
    return YES;
}




@end
